<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
//根据域名策略做路由规则
$routerMap = [
    env("MANAGE_URL") => 'backend.php',
    env("API_URL")    => 'api.php'
];
$httpHost = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : null;
if (empty($httpHost)) {
    include_once "console.php";
} else {
    $prefix =  explode('.',$httpHost)[0];
    //统一引入
    Route::group(['domain' => $httpHost],function() use ($routerMap,$httpHost){
        $path = $routerMap[$httpHost];
        Route::any('/share/upload', 'ShareController@upload');//图片上传
        Route::any('/share/editor-upload', 'ShareController@editorUpload');//图片上传
        Route::any('/share/file-upload', 'ShareController@fileUpload');//图片上传
        Route::any('/share/areas', 'ShareController@areas');//地址库
        include_once $path;
    });
}
